package cn.yuyin.item;

import javax.microedition.lcdui.Graphics;

import cn.yuyin.main.Main;
import cn.yuyin.page.InputBox;

public class SendMessageItem extends Item{

	private InputBox inputBox;
	public SendMessageItem(int index,int x, int y, String text,InputBox inputBox) {
		super(x, y, text);
		this.index = index;
		this.inputBox = inputBox;
		
		inputBox.item = this;
	}

	public void paint(Graphics g) {
//		if(index == Main.superPage.index){
//			ishaveFouse = true;
//		}else {
//			ishaveFouse = false;
//		}
		int color = g.getColor();
		
		if(ishaveFouse){
			g.setColor(0xEFEFEF);
			g.fillRect(x, y, Main.WIDTH, Main.HEIGHT/5+1);
			g.setColor(0x6396E7);
			g.drawRect(x+Main.margin+1, y+Main.rowspace+1, Main.WIDTH-2*Main.margin-2, Main.HEIGHT/5-2*Main.rowspace-2);
			g.drawRect(x+Main.margin, y+Main.rowspace, Main.WIDTH-2*Main.margin, Main.HEIGHT/5-2*Main.rowspace);
			g.setColor(0);
			g.drawLine(x+2*Main.margin+1, y+2*Main.rowspace+1,x+2*Main.margin+1 , y+2*Main.rowspace+1+Main.font.getHeight());
		}else{
			g.setColor(0xEFEFEF);
			g.fillRect(x, y, Main.WIDTH, Main.HEIGHT/5+1);
		}
		
		g.setColor(color);
	}

	public void keyReleased(int keyCode) {
		switch (keyCode) {
		case Main.key_OK:
			if(ishaveFouse)
			Main.display.setCurrent(inputBox);
			break;
		}
	}

	public void pointerPressed(int x, int y) {
		
	}

	public void pointerReleased(int x, int y) {
		
	}

}
